.class Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;
.super Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;
.source "GreystripeConfigurator.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator",
        "<",
        "Ljava/lang/Object;",
        ">;"
    }
.end annotation


# static fields
.field public static final AD_SIZE:Ljava/lang/String; = "adSize"

.field static final AD_SIZE_300_250:Ljava/lang/String; = "300x250"

.field static final AD_SIZE_320_50:Ljava/lang/String; = "320x50"

.field static final AD_SIZE_728_90:Ljava/lang/String; = "728x90"

.field static final AD_SIZE_INTERSTITIAL:Ljava/lang/String; = "interstitial"

.field public static final APP_ID:Ljava/lang/String; = "appId"

.field private static final GEO_TARGETING_PERMISSIONS:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private mAdSize:Ljava/lang/String;

.field private mAppId:Ljava/lang/String;

.field private mGeoLocationParams:Ljava/lang/String;

.field private mIsInterstitial:Z


# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 46
    const-class v0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->TAG:Ljava/lang/String;

    .line 51
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 86
    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    const-string v2, "android.permission.ACCESS_FINE_LOCATION"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-string v2, "android.permission.ACCESS_COARSE_LOCATION"

    aput-object v2, v0, v1

    invoke-static {v0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->GEO_TARGETING_PERMISSIONS:Ljava/util/List;

    return-void
.end method

.method constructor <init>()V
    .locals 0

    .prologue
    .line 112
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;-><init>()V

    .line 113
    return-void
.end method

.method static getAdSize(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter "adSize"

    .prologue
    .line 247
    const-string v0, "320x50"

    invoke-virtual {v0, p0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 248
    const-string v0, "320x50"

    .line 256
    :goto_0
    return-object v0

    .line 249
    :cond_0
    const-string v0, "300x250"

    invoke-virtual {v0, p0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 250
    const-string v0, "300x250"

    goto :goto_0

    .line 251
    :cond_1
    const-string v0, "728x90"

    invoke-virtual {v0, p0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 252
    const-string v0, "728x90"

    goto :goto_0

    .line 253
    :cond_2
    const-string v0, "interstitial"

    invoke-virtual {v0, p0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 254
    const-string v0, "interstitial"

    goto :goto_0

    .line 256
    :cond_3
    const-string v0, "320x50"

    goto :goto_0
.end method

.method private static getUseGeoLocation(Ljava/lang/String;)Z
    .locals 7
    .parameter "useGeoLocation"

    .prologue
    const/4 v2, 0x0

    .line 215
    const/4 v3, 0x0

    :try_start_0
    sget-object v4, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->GEO_TARGETING_PERMISSIONS:Ljava/util/List;

    const/4 v5, 0x0

    invoke-static {v3, v4, v5}, Lcom/burstly/lib/util/ManifestValidator;->customValidate(Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lcom/burstly/lib/util/ManifestValidator$ValidationResults;

    move-result-object v1

    .line 216
    .local v1, results:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    invoke-virtual {v1}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getMandatoryPermissions()Ljava/util/List;

    move-result-object v3

    invoke-interface {v3}, Ljava/util/List;->isEmpty()Z

    move-result v3

    if-eqz v3, :cond_0

    const-string v3, "true"

    invoke-virtual {v3, p0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v3

    if-eqz v3, :cond_0

    const/4 v2, 0x1

    .line 223
    .end local v1           #results:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    :cond_0
    :goto_0
    return v2

    .line 219
    :catch_0
    move-exception v0

    .line 220
    .local v0, exception:Landroid/content/pm/PackageManager$NameNotFoundException;
    sget-object v3, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v4, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->TAG:Ljava/lang/String;

    invoke-static {v0}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v5

    new-array v6, v2, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method private setAdSize(Ljava/util/Map;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .prologue
    .line 158
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    const-string v2, "adSizeCodeValue"

    invoke-interface {p1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    .line 159
    .local v0, defaultAdSize:Ljava/lang/Object;
    check-cast v0, Ljava/lang/String;

    .end local v0           #defaultAdSize:Ljava/lang/Object;
    invoke-static {v0}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->getAdSize(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    .line 160
    const-string v2, "adSize"

    invoke-interface {p1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    .line 161
    .local v1, serverAdSize:Ljava/lang/Object;
    if-eqz v1, :cond_0

    .line 162
    check-cast v1, Ljava/lang/String;

    .end local v1           #serverAdSize:Ljava/lang/Object;
    invoke-static {v1}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->getAdSize(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    .line 164
    :cond_0
    return-void
.end method

.method private setInterstitial(Ljava/util/Map;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .prologue
    .line 143
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    const-string v1, "isCodeValueInterstitial"

    invoke-interface {p1, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    .line 144
    .local v0, defaultInterstitial:Ljava/lang/Object;
    if-eqz v0, :cond_0

    .line 145
    check-cast v0, Ljava/lang/Boolean;

    .end local v0           #defaultInterstitial:Ljava/lang/Object;
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v1

    iput-boolean v1, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mIsInterstitial:Z

    .line 147
    :cond_0
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    if-eqz v1, :cond_1

    const-string v1, "interstitial"

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 148
    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mIsInterstitial:Z

    .line 150
    :cond_1
    return-void
.end method


# virtual methods
.method protected applyClientTargetingParamsToNetwork(Ljava/util/Map;)V
    .locals 0
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 169
    .local p1, clientTargetingParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    return-void
.end method

.method public configure(Ljava/lang/Object;)V
    .locals 0
    .parameter "objConfigure"

    .prologue
    .line 174
    return-void
.end method

.method getAdSize()Ljava/lang/String;
    .locals 1

    .prologue
    .line 237
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    return-object v0
.end method

.method getAppId()Ljava/lang/String;
    .locals 1

    .prologue
    .line 230
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAppId:Ljava/lang/String;

    return-object v0
.end method

.method isInterstitial()Z
    .locals 1

    .prologue
    .line 263
    iget-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mIsInterstitial:Z

    return v0
.end method

.method public readParameters(Ljava/util/Map;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalArgumentException;
        }
    .end annotation

    .prologue
    .line 118
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    invoke-virtual {p0, p1}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->applyClientTargetingIfAllowed(Ljava/util/Map;)V

    .line 120
    const-string v1, "appId"

    invoke-interface {p1, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    .line 121
    .local v0, val:Ljava/lang/Object;
    const-string v1, "appId can not be null"

    invoke-static {v0, v1}, Lcom/burstly/lib/util/Utils;->checkNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 122
    check-cast v0, Ljava/lang/String;

    .end local v0           #val:Ljava/lang/Object;
    invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAppId:Ljava/lang/String;

    .line 124
    invoke-direct {p0, p1}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->setAdSize(Ljava/util/Map;)V

    .line 125
    invoke-direct {p0, p1}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->setInterstitial(Ljava/util/Map;)V

    .line 126
    const-string v1, "300x250"

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    const-string v1, "320x50"

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    const-string v1, "728x90"

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    const-string v1, "interstitial"

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mAdSize:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    .line 128
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "Unknown adSize value provided"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 130
    :cond_0
    const-string v1, "useGeoLocation"

    invoke-interface {p1, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    .line 131
    .restart local v0       #val:Ljava/lang/Object;
    if-eqz v0, :cond_1

    .line 132
    check-cast v0, Ljava/lang/String;

    .end local v0           #val:Ljava/lang/Object;
    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mGeoLocationParams:Ljava/lang/String;

    .line 135
    :cond_1
    return-void
.end method

.method public updateLocation(Landroid/content/Context;)V
    .locals 10
    .parameter "ctx"

    .prologue
    const/4 v9, 0x0

    .line 180
    iget-object v5, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mGeoLocationParams:Ljava/lang/String;

    if-eqz v5, :cond_0

    iget-object v5, p0, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->mGeoLocationParams:Ljava/lang/String;

    invoke-static {v5}, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->getUseGeoLocation(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_0

    .line 181
    const-string v5, "location"

    invoke-virtual {p1, v5}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/location/LocationManager;

    .line 182
    .local v2, locationManager:Landroid/location/LocationManager;
    const/4 v4, 0x0

    .line 183
    .local v4, result:Landroid/location/Location;
    const/4 v1, 0x0

    .line 184
    .local v1, gpsLocation:Landroid/location/Location;
    const/4 v3, 0x0

    .line 186
    .local v3, networkLocation:Landroid/location/Location;
    :try_start_0
    const-string v5, "gps"

    invoke-virtual {v2, v5}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 191
    :goto_0
    :try_start_1
    const-string v5, "network"

    invoke-virtual {v2, v5}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;
    :try_end_1
    .catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_1} :catch_1

    move-result-object v3

    .line 196
    :goto_1
    if-eqz v1, :cond_2

    if-eqz v3, :cond_2

    .line 197
    invoke-virtual {v1}, Landroid/location/Location;->getTime()J

    move-result-wide v5

    invoke-virtual {v3}, Landroid/location/Location;->getTime()J

    move-result-wide v7

    cmp-long v5, v5, v7

    if-lez v5, :cond_1

    move-object v4, v1

    .line 202
    :goto_2
    if-eqz v4, :cond_0

    .line 203
    invoke-static {v4}, Lcom/greystripe/sdk/GSSdkInfo;->updateLocation(Landroid/location/Location;)V

    .line 206
    .end local v1           #gpsLocation:Landroid/location/Location;
    .end local v2           #locationManager:Landroid/location/LocationManager;
    .end local v3           #networkLocation:Landroid/location/Location;
    .end local v4           #result:Landroid/location/Location;
    :cond_0
    return-void

    .line 187
    .restart local v1       #gpsLocation:Landroid/location/Location;
    .restart local v2       #locationManager:Landroid/location/LocationManager;
    .restart local v3       #networkLocation:Landroid/location/Location;
    .restart local v4       #result:Landroid/location/Location;
    :catch_0
    move-exception v0

    .line 188
    .local v0, e:Ljava/lang/IllegalArgumentException;
    sget-object v5, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v6, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->TAG:Ljava/lang/String;

    const-string v7, "Failed to retrieve GPS location: No GPS found"

    new-array v8, v9, [Ljava/lang/Object;

    invoke-virtual {v5, v6, v7, v8}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0

    .line 192
    .end local v0           #e:Ljava/lang/IllegalArgumentException;
    :catch_1
    move-exception v0

    .line 193
    .restart local v0       #e:Ljava/lang/IllegalArgumentException;
    sget-object v5, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v6, Lcom/burstly/lib/component/networkcomponent/greystripe/GreystripeConfigurator;->TAG:Ljava/lang/String;

    const-string v7, "Failed to retrieve network location: No network provider found"

    new-array v8, v9, [Ljava/lang/Object;

    invoke-virtual {v5, v6, v7, v8}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_1

    .end local v0           #e:Ljava/lang/IllegalArgumentException;
    :cond_1
    move-object v4, v3

    .line 197
    goto :goto_2

    .line 199
    :cond_2
    if-eqz v1, :cond_3

    move-object v4, v1

    :goto_3
    goto :goto_2

    :cond_3
    move-object v4, v3

    goto :goto_3
.end method
